#include <iostream>
#include <cstdio>
using namespace std;
void qiuxiao(long long a[100000],long long n){
    long long m = 0;
    long long alive[10000],death[100000];
    while (a != 0){
        for (long long i = 0;i<n;i++){
            for (long long j = 0;j<n;j++){
                if (a[i] < a[j]){
                    alive[i] = a[i];
                    a[i] = 0;
                }
                else {
                    alive[i] = a[i];
                    a[i] = 0;
                    death[j] = a[j];
                    a[j] = 0;
                }
            }
        }
    }
    for (long long i = 0;i < n;i++){
        m += alive[i];
    }
    return m;
};
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    long long n,a[100000],num[100000];
    cin >> n;
    for (long long i = 0;i<n;i++){
        cin >> a[i];
    }
    for (long long i = 0;i < n;i++){
        num[i] = qiuxiao(a,n);
    }
    cout << min(num);
    fclose(stdin);
    fclose(stdout);
    return 0;
}
